﻿using System.Globalization;
using KinonekoSoftware.Foundation.Languages;


namespace KinonekoSoftware.Foundation.UI.Converters
{
    public class EnumToStringConverter : IValueConverter
    {
        public static EnumToStringConverter Instance { get; } = new EnumToStringConverter();
        
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {

            if (value is Enum @enum)
            {
                return LanguageManager.GetEnum(@enum);
            }

            return $"Failed To Translate -> {value}";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotSupportedException();
        }
    }
}